package 力扣日常刷题.木22一月.第18天0130;

/**
 * @author 帅小伙
 * @date 2022/1/30
 * @description
 * 行列差的较大值
 */
public class Demo40数组简单访问所有点的最小时间 {


    public int minTimeToVisitAllPoints(int[][] points) {
        int ans = 0;
        int n = points.length;
        if (n == 1)return 0;
        for (int i = 1; i < n; i++) {
            ans += Math.max(Math.abs(points[i][0] - points[i-1][0]),Math.abs(points[i][1] - points[i-1][1]));
        }
        return ans;
    }

}
